package lab03.test03;

import java.io.*;
public class Test{
    public static void main(String args[]){
        File file=new File("E:/","test.txt");
        byte b[]="Beijing 欢迎你！".getBytes();
        try{
            FileOutputStream out=new FileOutputStream(file);
            out.write(b);
            out.close();
            FileInputStream in=new FileInputStream(file);
            int n=0;
            while((n=in.read(b,0,2))!=-1){
                String str=new String(b,0,n);
                System.out.print(str);
            }
            FileWriter writer = new FileWriter("E:/test.txt", true);
            writer.write("我的学号是：你自己的学号");
            writer.close();
            n=0;
            while((n=in.read(b,0,2))!=-1){
                String str=new String(b,0,n);
                System.out.print(str);
            }
        }
        catch(IOException e){
            System.out.print(e);
        }
    }
}